﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/include/context.jsp" %>
<form action="${ctx}/purchase/related/add/do" method="post" onsubmit="return submit_delivery()"  style="margin: 0px;">
	<table cellspacing="0" cellpadding="0" class="form-grid">
		<tbody>
			<tr>
				<td>PO单号：</td>
				<td>${order.orderNumber}
					<input type="hidden" name="pid" value="${order.id}"/>	
					</td>
				<td>DO单号：</td>
				<td><input type="text" name="deliveryOrderName" id="deliveryOrderName" value="${doNumber}"/></td>
			</tr>
			<tr>
				<td>ASC代码：</td>
				<td>${order.maintenanceStation.number}</td>
				<td>ASC简称：</td>
				<td>${order.maintenanceStation.name}
					<input id="maintenanceStationId" type="hidden" name="maintenanceStationId" value="${order.maintenanceStation.id}">
				</td>
			</tr>
			<tr>
				<td>区域：</td>
				<td>${order.maintenanceStation.region.name}</td>
					<input type="hidden" name="regionId" value="${order.maintenanceStation.region.id}"/>
 				<td>订单日期：</td>
				<td>${order.orderDate}"</td>
			</tr>
			<tr>
				<td>
					配件信息
				</td>
				<td colspan="3">
					<table class="grid" cellspacing="0" width="40">
						<thead>
							<tr>
								<td>
									
									选择
								</td>	
							<td>配件代码</td>
							<td>配件名称</td>
							<td>配件规格</td>
							<td>需求数量</td>
							<td>匹配数量</td>
							</tr>
						</thead>
						<tbody>
							<c:forEach var="detail" items="${order.purchaseDetails}">
								<c:if test="${detail.balanceNumber != '0.00'}">
									<tr onmouseover="this.style.backgroundColor= '#f0f0f0'" onmouseout="this.style.backgroundColor= '#ffffff'" >
										<td> <input id="detail${detail.id}" type="checkbox" name="details" value="${detail.id}" disabled="disabled"> </td>
										<input type="hidden" name="productCodes" title="${detail.id}" value="${detail.product.productCode}"/>
										<input type="hidden" name="balanceNumbers" title="${detail.id}" value="${detail.balanceNumber}"/>
										<input type="hidden" value="${detail.balanceNumber}" id="number${detail.id}"/>
										<td>${detail.product.productCode}--${detail.product.id }</td>
										<td>${detail.product.productName}</td>
										<td>${detail.product.specification}</td>
										<td>${detail.balanceNumber}</td>
										<td><input id="deliveryNumber${detail.id}" title='${detail.balanceNumber}' name="deliveryNumber${detail.id}" disabled="disabled"></td>
									</tr>
								</c:if>
							</c:forEach>
						</tbody>
					</table>
				</td>
			</tr>
			<tr>
				<td>推荐仓储：</td>
				<td colspan="3">
					<table class="grid" cellspacing="0" width="40">
						<thead>
							<tr>
								<td>
									选择
								</td>	
							<td>仓储编号</td>
							<td>仓储名称</td>
							</tr>
						</thead>
						<tbody>
							<c:forEach var="warehouse" items="${lists}">
								<tr onmouseover="this.style.backgroundColor= '#f0f0f0'" onmouseout="this.style.backgroundColor= '#ffffff'">
									<td> <input type="checkbox" id="warehouseId${warehouse.id}" name="warehouseId" value="${warehouse.id}" onclick="getInvertory(this,${order.id})"> </td>
									<td>${warehouse.code}</td>
									<td>${warehouse.name}</td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
				</td>
			</tr>
		</tbody>
	</table>
	<input id="jsonList" type="hidden" name="jsonList"> 
	<div class="window_footer"><input type="submit" value="确定"></div>
</form>

<%@ include file="/include/script.jsp" %>